package com.agriculture.service;

import com.agriculture.domain.Order;
import com.agriculture.dto.Order.OrderStatusUpdateRequest;
import com.agriculture.dto.Order.OrderCancelRequest;


import java.util.List;

public interface OrderService {
    Order createOrder(Order order);
    Order getOrderById(Long id);
    List<Order> getOrdersByBuyer(Long buyerId, String orderType);
    List<Order> getOrdersBySeller(Long sellerId, String orderType);
    void updateLogistics(Long orderId, String logisticsNo);
    Order confirmDelivery(Long orderId);

    // 采购订单
    List<Order> getBuyOrders(String role, String status, String search, 
                            Long buyerId, Long sellerId, int offset, int pageSize);
    int countBuyOrders(String role, String status, String search, 
                       Long buyerId, Long sellerId);

    // 销售订单
    List<Order> getSellOrders(String role, String status, String search, 
                             Long sellerId, Long buyerId, int offset, int pageSize);
    int countSellOrders(String role, String status, String search, 
                        Long sellerId, Long buyerId);

    Order updateOrderStatus(Long orderId, OrderStatusUpdateRequest request);
    void cancelOrder(Long orderId, OrderCancelRequest request);

    // 获取已完成的采购订单
    List<Order> selectCompletedBuyOrders(String role, String status, String search, 
                                       Long buyerId, Long sellerId, int offset, int pageSize);
    int countCompletedBuyOrders(String role, String status, String search, 
                               Long buyerId, Long sellerId);

    /**
     * 从订单导入库存
     * @param orderId 订单ID
     * @param buyerId 买家ID
     * @param operator 操作人
     */
    void importOrderToInventory(Long orderId, Long buyerId, String operator);

    Order confirmShipment(Long orderId, String trackingNumber, OrderStatusUpdateRequest statusUpdate);
} 